package com.ssn.controller;

import com.ssn.po.Blog;
import com.ssn.service.impl.BlogServiceImpl;
import org.springframework.stereotype.Controller;
import org.springframework.ui.Model;
import org.springframework.web.bind.annotation.GetMapping;

import javax.annotation.Resource;
import java.util.*;

@Controller
public class ArchivesController {
    @Resource
    private BlogServiceImpl blogService;

    @GetMapping("/archives")
    public String archives(Model model) {
        // 获取已发布的博客
        model.addAttribute("archiveMap", blogService.archivesBlog());
        model.addAttribute("count", blogService.countBlogByPublished());
        return "archives";
    }


}
